package com.example.plumneedle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;

import android.os.Bundle;
import android.view.View;

import com.example.plumneedle.Framgment.BlankFragment1;
import com.example.plumneedle.Framgment.BlankFragment2;
import com.example.plumneedle.Framgment.BlankFragment3;
import com.example.plumneedle.Framgment.BlankFragment4;
import com.example.plumneedle.Framgment.BlankFragment5;

public class MainInterface extends AppCompatActivity {
    BlankFragment1 blankFragment1=new BlankFragment1();
    BlankFragment5 blankFragment5=new BlankFragment5();
    BlankFragment2 blankFragment2=new BlankFragment2();
    BlankFragment3 blankFragment3=new BlankFragment3();
    BlankFragment4 blankFragment4=new BlankFragment4();
    ConstraintLayout constraintLayout;
    ConstraintLayout constraintLayout1;
    ConstraintLayout constraintLayout2;
    ConstraintLayout constraintLayout3;
    ConstraintLayout constraintLayout4;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_interface);
        constraintLayout=findViewById(R.id.constraintLayout4);
        constraintLayout1=findViewById(R.id.constraintLayout3);
        constraintLayout2=findViewById(R.id.constraintLayout5);
        constraintLayout3=findViewById(R.id.constraintLayout6);
        constraintLayout4=findViewById(R.id.constraintLayout7);
        constraintLayout.setSelected(true);
        constraintLayout1.setSelected(false);
        constraintLayout2.setSelected(false);
        constraintLayout3.setSelected(false);
        constraintLayout4.setSelected(false);
        getSupportFragmentManager().beginTransaction().replace(R.id.framelayout,blankFragment1).commit();
        constraintLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                constraintLayout.setSelected(true);
                constraintLayout1.setSelected(false);
                constraintLayout2.setSelected(false);
                constraintLayout3.setSelected(false);
                constraintLayout4.setSelected(false);
                getSupportFragmentManager().beginTransaction().replace(R.id.framelayout,blankFragment1).commit();
            }
        });
        constraintLayout1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                constraintLayout.setSelected(false);
                constraintLayout1.setSelected(true);
                constraintLayout2.setSelected(false);
                constraintLayout3.setSelected(false);
                constraintLayout4.setSelected(false);
                getSupportFragmentManager().beginTransaction().replace(R.id.framelayout,blankFragment2).commit();
            }
        });

        constraintLayout2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                constraintLayout.setSelected(false);
                constraintLayout1.setSelected(false);
                constraintLayout2.setSelected(true);
                constraintLayout3.setSelected(false);
                constraintLayout4.setSelected(false);
                getSupportFragmentManager().beginTransaction().replace(R.id.framelayout,blankFragment3).commit();
            }
        });

        constraintLayout3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                constraintLayout.setSelected(false);
                constraintLayout1.setSelected(false);
                constraintLayout2.setSelected(false);
                constraintLayout3.setSelected(true);
                constraintLayout4.setSelected(false);
                getSupportFragmentManager().beginTransaction().replace(R.id.framelayout,blankFragment4).commit();
            }
        });

        constraintLayout4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                constraintLayout.setSelected(false);
                constraintLayout1.setSelected(false);
                constraintLayout2.setSelected(false);
                constraintLayout3.setSelected(false);
                constraintLayout4.setSelected(true);
                getSupportFragmentManager().beginTransaction().replace(R.id.framelayout,blankFragment5).commit();
            }
        });
    }
}
